#ifndef __RTC_H
#define __RTC_H

#include "cst92f2x.h"
#include "OSAL_Clock.h"

#define REG_RTC_CC2                (*((volatile unsigned int *)(0x4000f034)))
#define	RTCCNT					   (*((volatile unsigned int *)(0x4000f028)))
	
#define RTC_TIMEBASE			   (*((volatile uint64_t *) (0x1ffffff0)))	//RTC Timebase,64BIT,uint:s

#define RTC_CNT_RANGE 	0xFFFFFFFF	//rtc counter is 32bits
#define RTC_CLK_FREQ	32768		//rtc clock frequency is 32.768KHz
#define US_OF_S	        1000000		//1S

void HalRtcGetTime(UTCTimeStruct *getTime);		//HalRtcUpdate or HalRtcGetTime function should be called periodically, the periodic time < 512s, recommend 60s
void HalRtcSetTime(UTCTimeStruct *setTime);
UTCTime HalRtcGet_Utc(void);
void HalRtcSet_Utc(UTCTime utc);
void HalRtcInit(void);

#endif

